


import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;

import org.junit.BeforeClass;
import org.junit.Test;

import com.test.User;


public class JpaTest {

	@BeforeClass
	public static void setUpBeforeClass() throws Exception {
		
	
	}
	
	@Test
	public void saveUser() {
		
		System.err.println(Persistence.createEntityManagerFactory("mydesktop"));
		EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory("mydesktop");
				

		System.err.println(entityManagerFactory);
		EntityManager entityManager = entityManagerFactory.createEntityManager();
		entityManager.getTransaction().begin();
		entityManager.persist(new User());
		entityManager.getTransaction().commit();
		entityManager.close();
				
		entityManagerFactory.close();
	}

}
